<?php 
$css = ['/assets/jedate/skin/jedate.css'];
$this->load->view('admin/layout/head', array('title'=>"货损管理",'nav'=>'order','css'=>$css), FALSE);
?>

<div id="container">
	<form class="form-inline" id="search-form" method="GET" action="">
	  <div class="form-group">
	  	<select name="type" id="type_slt" class="form-control">
	  		<option value="">类型</option>
	  		<option value="0" <?php if($this->input->get('type') === '0') echo 'selected' ?>>损坏</option>
	  		<option value="1" <?php if($this->input->get('type') == 1) echo 'selected' ?>>过期</option>
	  	</select>
	  </div>
	  <div class="form-group">
	  	<input type="text" name="start_date" class="form-control date-picker" value="<?= $this->input->get('start_date') ?>" placeholder="<?= $this->lang->line('start date') ?>">
	  	<input type="text" name="end_date" class="form-control date-picker" value="<?= $this->input->get('end_date') ?>" placeholder="<?= $this->lang->line('end date') ?>">
	  </div>

	  <div class="form-group">
	  	<input type="text" name="code" class="form-control" value="<?= $this->input->get('code') ?>" placeholder="请输入商品二维码编号">
	  </div>
	  <button class="btn btn-info search-btn"><?= $this->lang->line('search') ?></button>
	  <a href="/admin/damage/create" class="btn btn-danger">添加</a>
	</form>
	

	<div class="table-container mt-10">
		<table class="table table-bordered table-striped table-hover scroll-table">
			<thead >
				<tr>
					<th class="text-center">id</th>
					<th class="text-center">类型</th>
					<th class="text-center">商品</th>
					<th class="text-center">型号</th>
					<th class="text-center">数量</th>
					<th class="text-center">时间</th>
					<th class="text-center">收银员</th>
				</tr>
			</thead>
			<tbody class="text-center">
				<?php foreach ($page as $key => $value): ?>
					<tr id="<?= $value['id'] ?>">
						<td><?= $value['id'] ?></td>
						<td><?= $value['type'] ? '过期' : '损坏' ?></td>
						<td><?= $value['product']['title'] ?></td>
						<td><?= $value['item']['title'] ?></td>
						<td><?= $value['qty'] ?></td>
						<td><?= $value['create_time'] ?></td>
						<td><?= $value['cashier']['username'] ?></td>
					</tr>
				<?php endforeach ?>
			</tbody>
			<?php if ($page->last_page>1): ?>
				<tfoot>
					<td colspan="10" style="text-align:right">
						<?php echo $page->render() ?>
					</td>
				</tfoot>
			<?php endif ?>
		</table>
	</div>
</div>


<?php 
$js = ['/assets/jedate/jedate.min.js'];
$this->load->view('admin/layout/footer',['js'=>$js]);
?>
<script type="text/javascript">
	$(function(){
		datepicker('.date-picker','<?php echo $this->session->admin_language ?>');
	})
</script>















